<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>支付宝绑定 - {:config('web.WEB_TIT')}</title>
	{include file="member/public"}
</head>
<body>
	<header data-am-widget="header" class="am-header am-header-default jz">
		<div class="am-header-left am-header-nav">
			<a href="javascript:history.back()" class="">
				<i class="am-icon-chevron-left"></i>
			</a>
		</div>
		<h1 class="am-header-title">
		  <a href="#title-link" class="">支付宝绑定</a>
		</h1>
	</header>
	<ul class="nav maa" style="margin-top: 10px;">
		<li>
			<span>姓名</span>
			<input type="text" name="alipay_name" id="alipay_name" value="{$member.alipay_name}" placeholder="请输入支付宝认证的真实姓名"/>
		</li>
		<li>
			<span>支付宝账号</span>
			<input type="text" name="alipay_no" id="alipay_no" value="{$member.alipay_no}" placeholder="请输入支付宝账号"/>
		</li>
		<li>
			<span>手机号码</span>
			<span style="margin-left: 1rem;">{$member.encryption_mobile}</span>
		</li>
		<li>
			<span>验证码</span>
			<input type="hidden" name="__token__" id="token" value="{$Request.token}" />
			<input type="" name="code" id="code" value="" placeholder="请输入验证码" style="width: 30%;"/>
			<em>获取验证码</em>
		</li>
	</ul>
	<div class="shure" id="submit">
		<a href="">立即绑定</a>
	</div>
	<script type="text/javascript">
        $('#submit').click(function(){
            var alipay_name = $('#alipay_name').val();
            var alipay_no = $('#alipay_no').val();
            var code = $('#code').val();
            if(code == ''){
                alert('请输入验证码');
                return false;
            }
            if(alipay_name == ''){
                alert('实名认证姓名不能为空');
                return false;
			}
			if(alipay_no == ''){
                alert('支付宝账号不能为空');
                return false;
			}
            $.ajax({
                type: 'POST',
                url : "{:url('member/set_alipay')}",
                data:{
                    alipay_name:alipay_name,
                    alipay_no:alipay_no,
					code:code,
					token:$('#token').val()
				},
                dataType:'json',
                success: function(data){
                    if(data.code == 200){
                        alert(data.msg)
                        window.location.href = "{:url('member/set')}";
                    }else{
                        alert(data.msg)
                        location.reload(true);
                    }
                },
            });
        });
	</script>
</body>
</html>
